//
//  MovvieListCell.m
//  UI16.真.豆瓣
//
//  Created by dllo on 15/10/30.
//  Copyright © 2015年 Amydom. All rights reserved.
//

#import "MovieListCell.h"
#import "AppTools.h"
#import "UIImageView+WebCache.h"
#define FULLFRAME [[UIScreen mainScreen]bounds]
@interface MovieListCell()

@property (nonatomic,retain)UILabel *nameLabel;
@property (nonatomic,retain)UIImageView *headImageView;


@end

@implementation MovieListCell

-(void)dealloc{
    [_posterImage release];
    [_joinDataLabel release];
    [_joinLabel release];
    [_interestDataLabel release];
    [_interestLabel release];
    [_moldLabel release];
    [_addressImage release];
    [_moldDataLabel release];
    [_timeImage release];
    [_titleLabel release];
    [_actImage1 release];
    [_actImage2 release];
    [super dealloc];
    
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubView];
        
    }
    return  self;
    
    
}

- (void)creatSubView{
    
    
    self.actImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 365, 176)];
    self.actImage1.backgroundColor = [UIColor whiteColor];
    self.actImage1.image = [UIImage imageNamed:@"bg_eventlistcell@2x.png"];
    self.actImage1.userInteractionEnabled = YES;
    [self.contentView addSubview:self.actImage1];
    [_actImage1 release];
    

    
    
    
    self.posterImage = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 120, 165)];
    self.posterImage.backgroundColor = [UIColor whiteColor];
    [self.actImage1 addSubview:self.posterImage];
    [_posterImage release];
    
    
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(145, 75, 200, 20)];
    //    self.titleLabel.backgroundColor = [UIColor whiteColor];
    [self.actImage1 addSubview:self.titleLabel];
    [_titleLabel release];
    
    
    
  
    

    

    
    
    
    
//    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 5, 200, 40)];
//    self.nameLabel.text = @"战神";
//    [self.contentView addSubview:self.nameLabel];
//    [_nameLabel release];
//    
//    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 10, 80 , 80*(FULLFRAME.size.height/FULLFRAME.size.width))];
//    self.headImageView.backgroundColor = [UIColor redColor];
//    //裁掉view的边界
//    self.headImageView.layer.masksToBounds = YES;
//    self.headImageView.layer.cornerRadius = 40;
//    //设置边框宽度
//    self.headImageView.layer.borderWidth = 3;
//    //设置边框颜色
//    self.headImageView.layer.borderColor = [UIColor orangeColor].CGColor;
//    
//    [self.contentView addSubview:self.headImageView];
//    [_headImageView release];
    
    
}



- (void)setMyMovie:(Movie *)myMovie{
    
    if (_myMovie != myMovie) {
        [_myMovie release];
        _myMovie = [myMovie retain];
        
    }
    self.titleLabel.text = self.myMovie.movieName;
    /*
    [AppTools getImageWithURL:self.myMovie.pic_url Block:^(NSData *data) {
        //从子线程回到主线程
        dispatch_async(dispatch_get_main_queue(), ^{
            //是否为主线程
            NSLog(@"===%d",[NSThread isMainThread]);
        self.posterImage.image = [UIImage imageWithData:data];

        });
        
        
    }];
    
    */
    
    NSURL *url = [NSURL URLWithString:self.myMovie.pic_url];
    [self.posterImage sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"e8db9451737015bf9622f88a14cc9a40.jpg"]];
    
    
    
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
